public class MyTask implements Comparable<MyTask> {
    private Runnable runnable;
    private  long time;

    public MyTask() {
        System.out.println(1);
    }
    public void tad() {
        System.out.println(2);
    }
    public MyTask(Runnable runnable, long time) {
        this.runnable = runnable;
        this.time = time;
    }
    public long getTime() {
        return this.time;
    }
    //执行任务
    public void run() {
        runnable.run();
    }
    @Override
    public int compareTo(MyTask o) {
        return (int)(this.time - o.time);
    }
}
